import {Injectable} from '@angular/core';
import {Headers, RequestOptions} from '@angular/http';
import {adSystemApiUrl} from '../../../config/api';
import {HttpService} from '../../lib/service/http.service';

@Injectable()

export class CityService {

  	constructor(private httpService: HttpService) {

  	}
  	getProvinceList() {
	    const url = `${adSystemApiUrl}/v1/member/comm/address/province_list`;
	    return this.httpService.httpGetAuth(url).map(rs => rs);
	}

	getCityList(province_id) {
	    const url = `${adSystemApiUrl}/v1/member/comm/address/city_list?province_id=${province_id}`;
	    return this.httpService.httpGetAuth(url).map(rs => rs);
	}

	getRegionList(city_id) {
	    const url = `${adSystemApiUrl}/v1/member/comm/address/region_list?city_id=${city_id}`;
	    return this.httpService.httpGetAuth(url).map(rs => rs);
	}
}
